package com.oldking.domain;

import com.oldking.domain.VideoInfo;

import java.util.ArrayList;
import java.util.List;

public class VideoData {
    public static int currentTime = 0;
    public static String key;
    public static List<VideoInfo> videoInfoList = new ArrayList(0);
    public static List<AudioInfo> audioInfoList = new ArrayList(0);

    public static int getCurrentTime() {
        return currentTime;
    }

    public static void setCurrentTime(int currentTime) {
        VideoData.currentTime = currentTime;
    }

    public static String getKey() {
        return key;
    }

    public static void setKey(String key) {
        VideoData.key = key;
    }

    public static List<VideoInfo> getVideoInfoList() {
        return videoInfoList;
    }

    public static void setVideoInfoList(List<VideoInfo> videoInfoList) {
        VideoData.videoInfoList = videoInfoList;
    }

    public static List<AudioInfo> getAudioInfoList() {
        return audioInfoList;
    }

    public static void setAudioInfoList(List<AudioInfo> audioInfoList) {
        VideoData.audioInfoList = audioInfoList;
    }

    public static VideoInfo getVideoInfoByKey(String value) {
        List<VideoInfo> videoInfoList = VideoData.getVideoInfoList();
        VideoInfo vi = new VideoInfo();
        for (VideoInfo videoInfo : videoInfoList) {
            if (videoInfo.getPath().equals(value)) {
                return videoInfo;
            }
        }
        return vi;
    }
    public static AudioInfo getAudioInfoByKey(String id) {
        if (id.isEmpty()){
            return null;
        }
        List<AudioInfo> audioInfoList = VideoData.getAudioInfoList();
        AudioInfo vi = new AudioInfo();
        for (AudioInfo audioInfo : audioInfoList) {
            if (id.equals(audioInfo.getAudioTaskNameColumn())) {
                return audioInfo;
            }
        }
        return vi;
    }
}
